{% extends "wltheme/base_list.html" %}
{% load future wenlincms_tags article_tags wlcore_tags %}

{% block meta_title %}官方资讯{% endblock %}

{% block breadcrumb_menu %}
    <div class="am-container">
        <ol class="am-breadcrumb">
            <li><a href="/" class="am-icon-home">{{ sitesettings.title }}</a></li>
            <li><a href="/zhi">官方资讯</a></li>
            {% if category %}
                <li><a>{{ category }}</a></li>
            {% endif %}
        </ol>
    </div>
    {#下面加一个分割行占位#}
    <div class="wl-container" style="padding: 6px 0;box-shadow: none"></div>
{% endblock %}

{% block main %}
    <div class="am-u-md-10">
        <div class="wl-container" style="padding: 0">
            <div class="wl-banner-paixu">
                {% if category %}
                    <h2>{{ category }}</h2>
                {% else %}
                    <h2>官方资讯</h2>
                {% endif %}
                <dl>
                    <dt>共有 <span class="am-badge am-badge-success">{{ count_total }}</span> 条资讯</dt>
                    <dd>
                        <ul>
                            <li style="margin: 3px 0 0 18px">
                                <input placeholder="在结果中搜索" class="am-form-field">
                            </li>
                        </ul>
                    </dd>
                </dl>
            </div>

            {% for the_post in the_posts.object_list %}
                <div class="wl-post-list">
                    <table>
                        <tr>
                            <td>
                                <h2>
                                    <a href="{{ the_post.get_absolute_url }}">{{ the_post.title|truncatechars:36 }}</a>
                                    {% if the_post.allow_comments %}
                                        <span>
                                            <a href="{{ the_post.get_absolute_url }}#comments" title="评论"
                                               target="_blank">
                                                <i class="am-icon-comment-o"></i>&nbsp;{{ the_post.comments_count }}
                                            </a>
                                        </span>
                                    {% endif %}
                                </h2>

                                <div class="wl-list-detail">
                                    <div class="list-footer-meta">
                                        <i class="am-icon-bookmark-o moveicon-6"></i>发布时间：{{ the_post.created|date:"Y-m-j" }}
                                        {% with the_post.categories.all as categories %}
                                            {% if categories %}&nbsp;&nbsp;&nbsp;&nbsp;
                                                <i class="am-icon-bars moveicon-6"></i>资讯类别：
                                                {% for category in categories %}
                                                    <a href="{% url "article_post_list_category" category.slug %}"
                                                       class="wl-taglink">{{ category }}</a>
                                                    {% if not forloop.last %}, {% endif %}
                                                {% endfor %}
                                            {% endif %}
                                        {% endwith %}
                                    </div>
                                    <div class="list-row">
                                        {{ the_post.content|wlstrip|truncatewords_html:20|striptags|safe }}
                                    </div>
                                </div>
                            </td>
                        </tr>
                    </table>

                </div>
            {% endfor %}

            {% pagination_for the_posts %}
        </div>
    </div>
{% endblock %}

{% block left_panel %}
    {% include "wltheme/article/side_panel.html" %}
{% endblock %}
